<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<!--系统管理 菜单添加-->
<!-- Section - Bootstrap Brain Component -->
<section class="pb-3 pb-md-4 pb-xl-5 bg-light" th:fragment="MenuAdd">
    <div class="container">
        <div class="row gy-3 gy-md-4">
            <div class="col-12 col-lg-6">
                <div class="row gy-3 gy-md-4">
                    <div class="col-12">
                        <div class="card widget-card border-light shadow-sm">
                            <div class="card-header bg-transparent p-4 border-light-subtle">
                                <h5 class="card-title widget-card-title m-0" th:text="${menuBean != null?'编辑菜单':'添加菜单'}"></h5>
                            </div>
                            <div class="card-body p-4">
                                <form class="row g-3" th:method="post" th:action="@{/menuSaveOrUpdate}">
                                    <div class="visually-hidden col-md-6">
                                        <label for="inputName" class="form-label">编码</label>
                                        <input type="number" class="form-control" id="inputId" name="id" th:value="${menuBean?.id}" placeholder="请输入ID">
                                    </div>
                                    <div class="col-md-6">
                                        <label for="inputName" class="form-label">名称</label>
                                        <input type="text" class="form-control" id="inputName" name="name" th:value="${menuBean?.name}" placeholder="请输入名称" required>
                                    </div>
                                    <div class="col-md-6">
                                        <label for="inputMarks" class="form-label">标识</label>
                                        <input type="text" class="form-control" id="inputMarks" name="menuMarks"
                                               th:value="${menuBean?.menuMarks}"
                                               onkeyup="value=value.replace(/[^a-zA-Z]/g,'')"
                                               placeholder="请输入标识"
                                               required> <!--th:readonly="${menuBean != null}"-->
                                    </div>
                                    <div class="col-12">
                                        <label for="inputDesc" class="form-label">描述</label>
                                        <input type="text" class="form-control" id="inputDesc" name="menuDesc" th:value="${menuBean?.menuDesc}" placeholder="请输入描述">
                                    </div>

                                    <div class="col-12">
                                        <label for="inputParent" class="form-label">上级菜单</label>
                                        <select class="form-select" id="inputParent" name="parentId">
                                            <option value="0" th:selected="${menuBean == null}">选择上级菜单...</option>
                                            <option th:each="item : ${menuOptionList}"
                                                    th:value="${item.id}"
                                                    th:text="${item.name}"
                                                    th:selected="${menuBean!= null && item.id==menuBean.parentId}"></option>
                                        </select>
                                    </div>

                                    <div class="col-12">
                                        <div class="form-check">
                                            <input class="form-check-input" type="checkbox" id="enableCheck" th:name="isEnable">
                                            <label class="form-check-label" for="enableCheck">
                                                是否启用
                                            </label>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <button type="submit" class="btn btn-primary" th:text="${menuBean == null?'添加':'保存'}">添加</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</section>
</html>